package com.example.desinger.designPattern;

import com.example.desinger.entity.Students;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
// 分组操作者
public class GroupOperator {

    // 分组策略
    private ISplitGroupStratagem splitGroupStratagem;
    private int totalGroup; // 分组总数
    private List studentsList; // 学生列表

    public GroupOperator(List<Students> studentsList, int totalGroup) {
        this.studentsList = studentsList;
        this.totalGroup = totalGroup;
    }

    // 分组操作
    public ArrayList group() {
        return splitGroupStratagem.splitGroup(this.totalGroup, this.studentsList);
    }

}
